<?php
/* 
 * ebiz front
 * 
 * ShoppingcartView
 * 
 * @author allen
 * 
 */

?>
<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>
<html xmlns='http://www.w3.org/1999/xhtml'>
    <head>
        <meta content='text/html; charset=utf-8' http-equiv='Content-Type' />
        <title>购物车 - 阿基米米网上商城</title>
        <script type='text/javascript' language='javascript' src='//<?php echo ConfigConstants::$iConstants.".".DOMAIN; ?>/n/javascript/lib/jquery.js'></script>
        <script type='text/javascript' language='javascript' src='//<?php echo ConfigConstants::$iConstants.".".DOMAIN; ?>/n/javascript/frontend.js'></script>
        <script type='text/javascript' language='javascript' src='//<?php echo ConfigConstants::$iConstants.".".DOMAIN; ?>/t/<?php echo $config['template_name']; ?>/javascript/akimimi.js'></script>
        <link href='//<?php echo ConfigConstants::$iConstants.".".DOMAIN; ?>/t/<?php echo $config ['template_name']; ?>/css/style.css' rel='stylesheet' type='text/css' />
        <link href='//<?php echo ConfigConstants::$iConstants.".".DOMAIN; ?>/t/<?php echo $config ['template_name']; ?>/css/cart.css' rel='stylesheet' type='text/css' />
        <link href='//<?php echo ConfigConstants::$iConstants.".".DOMAIN; ?>/t/<?php echo $config ['template_name']; ?>/css/headerAndFooter.css' rel='stylesheet' type='text/css' />
    </head>
    <body>
    
        <?php echo $headerView; ?>
        
        <!-- center content begin -->

            <?php     
            if(empty($shoppingCartInfo) || $shoppingCartInfo == null){  //if user is not buy goods
            ?>
            <div id="MainContent">
                <div class="navigation"><img src="<?php echo ConfigConstants::getTImagePath(); ?>/dingdan_01.jpg" height="34" width="969" alt='' /></div>
                <div class="my_cart1"><img src="<?php echo ConfigConstants::getTImagePath(); ?>/gouwuche_06.jpg" height="37" width="969" alt='' /></div>
                
	            <div style="margin-left: 40px; padding-top:50px;; margin-bottom: 40px; width:900px;">
	                <h2><?PHP echo SHOPPINGCARTEMPTYLABEL; ?></h2>
	                <?PHP echo SHOPPINGCARTPROMPTLABEL; ?>
	                <a style="text-decoration: underline;color:red;" href="/"><?PHP echo SHOPPINGCARTEMPTYLINK; ?></a>
	                .
	            </div>
            </div>
            <?php
            }else{ //if user is login
            ?>
            <!-- MainContent begin -->    
            <div id="MainContent">
                <div class="navigation"><img src="<?php echo ConfigConstants::getTImagePath(); ?>/dingdan_01.jpg" height="34" width="969" alt='' /></div>
                <div class="my_cart1"><img src="<?php echo ConfigConstants::getTImagePath(); ?>/gouwuche_06.jpg" height="37" width="969" alt='' /></div>
                
                <form method="post" action="/o/updateShoppingCart" name="shoppingCartForm" id="shoppingCartForm" >
                <!-- this is prompt info of internationalization -->
                <input type="hidden" id="prompt" value="<?php echo SHOPPINGCARTPROMPT; ?>" />
                <!-- my_cart2 begin -->
                <div class="my_cart2">
	                <!-- shopping cart title begin -->
	                <div class="my_cart2_title">
	                    <ul>
	                        <li style="width: 120px;">商品编号</li>
	                        <li style="width: 380px;">商品名称</li>
	                        <li style="width: 100px;">商品价格</li>
	                        <li style="width: 120px;">购买数量</li>
	                        <li style="width: 100px;">合计金额</li>
	                    </ul>
	                </div>
	                <!-- shopping cart title end -->
                    <?php
                        $ljtSrc = "//".ConfigConstants::$iConstants.".".DOMAIN."/t/".$config['template_name']."/image/ljt.png";
                        $imageSize = "60.png";
                        foreach ($shoppingCartInfo as $key => $item) { 
//                            if(isset($item['folder']) && isset($item['name']) && !empty($item['folder']) && !empty($item['name']) ){
//                                $src = "//".ConfigConstants::$piConstants.".".DOMAIN."/p".$item['folder'].$item['name']."_".$imageSize;
//                            }else{
//                                $src = "//".ConfigConstants::$iConstants.".".DOMAIN."/t/".$config['template_name']."/image/product"."_".$imageSize;
//                            }
                    ?>
                    <!-- shopping cart info begin -->    
	                <div class="my_cart2_body">
	                    <ul id="Item0">
	                        <li style="width: 120px; color: rgb(74, 10, 72);" id="Item0Code"><?php echo $item['upc']; ?></li>
	                        <li style="width: 380px; color: rgb(74, 10, 72);" id="Item0Title">
		                        <label title="<?php echo $item['title']; ?>"><?php echo $item['title']; ?></label>
                                <p>
		                        <?php 
		                            $orderService = new OrderService();
		                            $itemId = $item["pItemId"];
		                            $itemAttribute = $orderService->getItemAttribute($itemId);
		                            if( !empty($itemAttribute) ){
		                              foreach ($itemAttribute as $itemAttr) { 
	                            ?>
                                
	                            <?php echo $itemAttr["attr"]; ?>
	                            <span style="color:#5fb820;margin-right:10px;">[<?php echo $itemAttr["attr_title"]; ?>]</span>
                                
	                            <?php  
		                              } 
		                            } 
		                        ?>
                                </p>
                            </li>
	                        <li style="width: 100px; font-family: '宋体'; font-size: 14px; color: rgb(173, 11, 0); font-weight: bold;"><?php echo UNIT.$item['sale_price']; ?></li>
	                        <li style="width: 120px;">
	                            <div class="my_cart2_text">
	                                <input type="text" maxlength="4" size="2" value="<?php echo $item['quantity']; ?>" name="quantity[]" />
	                                <input type="hidden" value="<?php echo $item['sale_price']; ?>" name="salePrice[]"/>
	                                <input type="hidden" value="<?php echo $item['pItemId']; ?>" name="itemId[]"/>
	                                <?php
	                                    if(AAService::isLogin()){
	                                ?>
	                                <input type="hidden" value="<?php echo $item['scId']; ?>" name="scId[]"/>
	                                <?php } ?>
	                            </div>
	                            <input src="<?php echo ConfigConstants::getTImagePath(); ?>/gouwuche_button.jpg" name="button" value="修改" type="submit" />
	                        </li>
	                        <li style="width: 100px; font-family: '宋体'; font-size: 14px; color: rgb(173, 11, 0); font-weight: bold; padding-left: 10px;">
	                            <div class="my_cart2_text2">
	                                <!--<input name="sumprice" id="sumprice0" value="MOB0001034" type="checkbox" />-->
	                                <?php
	                                   if(isset($item['scId'])){
	                                ?>
	                                <a href="javascript:;"  onclick="shoppingcart.deleteshoppingcart(<?php echo $item['scId']; ?>)" >
	                                    <img alt="" src="<?php echo $ljtSrc; ?>" style="border: 0px; width:15px;height:25px;" />
	                                </a>
	                                <?php
	                                    }else{
	                                ?>
	                                <a href="javascript:;"  onclick="shoppingcart.delcookieshoppingcart(<?php echo $item['pItemId']; ?>)" >
	                                    <img alt="" src="<?php echo $ljtSrc; ?>" style="border: 0px; width:15px;height:25px;" />
	                                </a>
	                                <?php
	                                    }
	                                ?>
	                            </div>
	                            <?php
	                                 $count = $item['quantity'];
	                                 $salePrice = $item['sale_price'];
	                            ?>
	                            <div class="my_cart2_text1"><?php echo UNIT.number_format($count * $salePrice, 2); ?></div>
	                        </li>
	                    </ul>
                        <?php /*
                            $orderService = new OrderService();
                          	$itemId = $item["pItemId"];
                          	$itemAttribute = $orderService->getItemAttribute($itemId);
                            if( !empty($itemAttribute) ){
                        ?>
                        <ul style="margin-left:300px;">
                            <?php foreach ($itemAttribute as $itemAttr) { ?>
                            
                            <li><?php echo $itemAttr["attr"]; ?></li>
                            <li style="margin-right:10px;"> [ <?php echo $itemAttr["attr_title"]; ?> ] </li>
                            <?php  }  ?>
                        </ul>
                        <?php   } */?>
	                </div>
                    <?php }?>
                    <!-- shopping cart end -->
	                <!-- shopping cart summary begin -->
	                <div class="my_cart2_price">商品价格合计：
	                    <font color="#ff0000"><?php
	                            $grandTotal = 0;
	                            foreach ($shoppingCartInfo as $item) {
	                                $grandTotal += $item['quantity'] * $item['sale_price']; 
	                            }
	                            echo UNIT.number_format($grandTotal, 2);    
	                            ?> - <?php echo UNIT; ?>0 = <?php echo UNIT.number_format($grandTotal, 2); ?></font>
	                    <!-- <span id="del_product"><a href="#">删除所选商品</a></span> -->
	                </div> 
	                <!-- shopping cart summary end -->
                </div>
                <!-- my_cart2 end -->
	            <div class="my_cart3"><img src="<?php echo ConfigConstants::getTImagePath(); ?>/gouwuche_13.jpg" height="14" width="969"></div>
	            <!-- shopping action begin -->
	            <div class="nav_submit">
	                <div class="nav_submit_1">
	                    <img src="<?php echo ConfigConstants::getTImagePath(); ?>/gouwuche_19.jpg" height="16" width="20">
                        <span><a href="/">继续购物</a></span>
	                    <!-- 
                        <img src="<?php echo ConfigConstants::getTImagePath(); ?>/gouwuche_21.jpg" height="16" width="16">
                        <span><a href="http://www.akimimi.cn/product/Aspsrc/CartSave.asp?action=removeItem" onclick=" return confirm('你确认清空购物车！')">清空购物车</a></span>
	                     -->
                    </div>
	                <div class="nav_submit_2"><a href="javascript:shoppingcart.checkout();"><img src="<?php echo ConfigConstants::getTImagePath(); ?>/gouwuche_16.jpg" height="28" border="0" width="117"></a></div>
	            </div>
	            <!-- shopping action end -->
                </form>
            </div>
            <!-- MainContent end -->
            <?php }?>
        <!-- center content end -->
        

        <?php echo $footerView; ?>

    <!-- prompt info div   #76A73A;  
    <div id="checkcurrent" style="display: none; border: 2px solid rgb(245, 108, 188); padding: 5px;  left: 40%; top: 30%; position: absolute; z-index: 9999; width: 350px; height: auto; background-color: rgb(255, 255, 255); font-size: 12px; text-align: center;">
      -->
    <div id="checkcurrent" style="display: none; border: 2px solid  #76A73A;          padding: 5px;  left: 40%; top: 30%; position: absolute; z-index: 9999; width: 350px; height: auto; background-color: rgb(255, 255, 255); font-size: 12px; text-align: center;">
        <div style="margin-top: 15px; margin-bottom: 10px; text-align: left; margin-left: 5px;"><?php echo SHOPPINGCARTPQUANTITYROMPT; ?></div>
        <div id="currentinfo" style="margin-bottom: 10px; text-align: left; margin-left: 5px;"> 
        
        </div>
        <div style="margin: 0pt auto; bottom: 3px; left: 40%; color: rgb(255, 0, 0); font-weight: bold; cursor: pointer;">
            <span onclick="javascript:window.location='/u/cart';">[<?php echo SHOPPINGCARTEMPTYLINK; ?>]</span>
            <span onclick="javascript:shoppingcart.submitCheckOut();">[<?php echo SHOPPINGCARTCONTINUECHECKOUTLINK; ?>]</span>
        </div>
    </div>
    
    <!-- prompt info div -->
    
    </body>
</html>



